<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<script type="text/javascript">
	window.onload=function(){
		 del = document.getElementsByClassName('del');
		 
		 for(var i=0;i<del.length;i++){
		 	run(i);
		 }
		 function run(x){
		 	del[x].onclick=function(){
		 	del[x].parentNode.parentNode.style.display='none';
		 }
		 	
	}
}
	</script>
	<title>删除表的操作</title>
</head>
<body>
	<table border="1">
		<tr>
			<td>姓名</td>
			<td>年龄</td>
			<td>操作</td>
		</tr>
		<tr>
			<td>1王二</td>
			<td>18  </td>
			<td><input type="button" value="删除" class="del"></td>
		</tr>
		<tr>
			<td>王二</td>
			<td>18  </td>
			<td><input type="button" value="删除" class="del"></td>
		</tr>
		<tr>
			<td>2王二</td>
			<td>18  </td>
			<td><input type="button" value="删除" class="del"></td>
		</tr>
		<tr>
			<td>3王二</td>
			<td>18  </td>
			<td><input type="button" value="删除" class="del"></td>
		</tr>
		<tr>
			<td>4王二</td>
			<td>18  </td>
			<td><input type="button" value="删除" class="del"></td>
		</tr>
		<tr>
			<td>5王二</td>
			<td>18  </td>
			<td><input type="button" value="删除" class="del"></td>
		</tr>
		<tr>
			<td>6王二</td>
			<td>18  </td>
			<td><input type="button" value="删除" class="del"></td>
		</tr>
	</table>
</body>
</html>